﻿using System;
using System.Web.UI;
using Test.DAL;
using Test.IDAL;

namespace Test
{
    public partial class ClassInfoAdd : System.Web.UI.Page
    {
        IClassInfoDAL bll = new ClassInfoDAL();
        protected void Page_Load(object sender, EventArgs e)
        {
            UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            var name = TextBox1.Value;
            var cont = TextBox2.Text;
            Model.ClassInfo info = new Model.ClassInfo()
            {
                Name = name,
                content = cont
            };
            var result = bll.Insert(info);
            if (result.States && result.Data > 0)
            {
                Response.Write("<script>alert('添加成功');location='ClassInfo.aspx';</script>");
            }
            else {
                Response.Write("<script>alert('" + result.message + "')</script>");
            }
        }
    }
}